import request from '/@/utils/request';
export async function queryDics() {
	return await request({
		url: '/dic/get/all',
		method: 'get',
	});
}
export async function queryDicsToCode(code: string) {
	return await request({
		url: `/dic/get/${code}/code`,
		method: 'get',
	});
}
//新增字典
export async function postDic(params?: object) {
	return await request({
		url: '/dic/post',
		method: 'post',
		data: params,
	});
}
//编辑字典
export async function putDic(params?: object) {
	return await request({
		url: '/dic/put',
		method: 'put',
		data: params,
	});
}
export async function saveDic(params?: any) {
	if (params.id > 0) {
		return await putDic(params);
	} else {
		return await postDic(params);
	}
}
export async function delDic(params?: object) {
	return await request({
		url: '/dic/delete',
		method: 'delete',
		data: params,
	});
}
export async function queryPagerDics(params: any) {
	return await request({
		url: '/dic/get/pager',
		method: 'get',
		params,
	});
}
export async function queryToParentCode(code: string) {
	return await request({
		url: `/dic/get/${code}/code`,
		method: 'get',
	});
}

export async function queryToParentId(pid: string) {
	return await request({
		url: `/dic/get/${pid}`,
		method: 'get',
	});
}

export async function queryHardwareDicItem() {
	return await request({
		url: '/dic/get/yjpz/code',
		method: 'get'
	});
}
